import axios from 'axios'
import Vue from 'vue';

export default {
  //Vue.use()函数
  install: function(vue) {
    var obj = axios.create({
      baseURL: "http://127.0.0.1:8888/api/private/v1/",
      timeout: 5000
    });
    // 挂载拦截器
    obj.interceptors.request.use(config => {
      // console.log(config);
      config.headers.Authorization = window.sessionStorage.getItem('token');
       //必须return config
      return config;
    });
    vue.prototype.$http = obj;
  }
}